package com.casic.config;

import com.casic.common.utils.FTPClientFactory;
import com.casic.common.utils.FTPClientPool;
import com.casic.common.utils.FTPPoolConfig;
import com.casic.common.utils.UploadFileUtil;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * Created by liuruijie on 2017/2/21.
 * 一些工具bean
 */
@Configuration
public class Cfg_Util {

    @Autowired
    private FTPPoolConfig ftpPoolConfig;
    @Autowired
    private FTPClientFactory ftpClientFactory;

    @Value("${ftp.maxSize}")
    private int maxSize;

    @Bean
    public FTPPoolConfig getftpPoolConfig() {
        return new FTPPoolConfig();
    }

    @Bean
    public FTPClientFactory getftpClientFactory() {
        return new FTPClientFactory(ftpPoolConfig);
    }

    @Bean
    public FTPClientPool getftpClientPool() {
        return new FTPClientPool(ftpClientFactory, maxSize);
    }

    @Bean
    public UploadFileUtil uploadFileUtil() {
        return new UploadFileUtil();
    }
}
